<?php
require ('../classes/Conf.php');
require ('../classes/ConnectionSecure.php');
include ('../validar_sesion.php');
include ('./classes/Connection.php');
include ('./classes/Transacciones.php');
?>

<html>
    <head>
        <title>Aprobaci&oacute;n de Transacciones</title>
        <link href="./template/css/bootstrap.min.css" rel="stylesheet"> 
    </head>

    <body>
        <div class="container theme-showcase" role="main">
            <div class="jumbotron">
                <h2>Aprobaci&oacute;n de transferencias mayores a 10.000</h2>
            </div>
        
        <center><a href="../index.php">Regresar...</a><p><a href="../salir.php">Salir</a></center>

    <?php
    $obj = new Transacciones();
    $result = $obj->consultarTransaccionesPendientes();
    ?> 

    <?php
    if (mysql_num_rows($result) > 0) {
        echo "<form method=post action=form.php name=myform>";
        foreach ($result as $row) {
            echo "<input style=inline type='radio' name='ids[]' value='$row[id]'>";
            echo $row[name] . "<br>";
        }

        echo "<button type='submit' name='submit' class='btn btn-success'>Aprobar</button>";
        echo "</form>";
    } else {
        ?>
        <div class="alert alert-warning">
            <strong>No hay transacciones por aprobar</strong>
        </div>
        <?php
    }

    if (@$_POST['submit']) {

        foreach ($_POST[ids] as $ids) {

            $transac = new Transacciones();
            $transac->aprobarTransaccion($id, $idaprueba);
            ?>
            <div class="alert alert-success">
                <strong>Transaccion aprobada!</strong>
            </div>
            <?php
        }
    }
    ?>
</div>
</body> 
</html>